import grok


class Jobs(grok.Container):

    def __init__(self):
        super(Jobs, self).__init__()


class JobsTraverser(grok.Traverser):
    grok.context(Jobs)

    def traverse(self, name):
        if name in self.context.keys():
            #if self.context[name].status != 'nonexisting':
            return self.context[name]
        return JobsError(self.context, self.request)


class JobsError(grok.View):
    grok.context(Jobs)


class Index(grok.View):
    grok.context(Jobs)

    def update(self):
        self.redirect(self.url(self.__parent__.__parent__))
